package org.fisco.bcos.sdk.demo.contract;

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.v3.client.Client;
import org.fisco.bcos.sdk.v3.codec.datatypes.Function;
import org.fisco.bcos.sdk.v3.codec.datatypes.Type;
import org.fisco.bcos.sdk.v3.codec.datatypes.TypeReference;
import org.fisco.bcos.sdk.v3.codec.datatypes.Utf8String;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.Uint256;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.tuples.generated.Tuple2;
import org.fisco.bcos.sdk.v3.codec.datatypes.generated.tuples.generated.Tuple3;
import org.fisco.bcos.sdk.v3.contract.Contract;
import org.fisco.bcos.sdk.v3.crypto.CryptoSuite;
import org.fisco.bcos.sdk.v3.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.v3.model.CryptoType;
import org.fisco.bcos.sdk.v3.model.TransactionReceipt;
import org.fisco.bcos.sdk.v3.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.v3.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class ParallelSmallbank extends Contract {
    public static final String[] BINARY_ARRAY = {
        "60806040526110066000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561005257600080fd5b506113eb806100626000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063870187eb11610066578063870187eb1461047c578063901d706f14610541578063bca926af14610693578063ca3054351461069d578063d39f70bc146107f95761009e565b80630b488b37146100a35780630be8374d1461016857806334a18dda1461022d5780633a51d246146102f257806379fa913f146103c1575b600080fd5b610166600480360360408110156100b957600080fd5b81019080803590602001906401000000008111156100d657600080fd5b8201836020820111156100e857600080fd5b8035906020019184600183028401116401000000008311171561010a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610803565b005b61022b6004803603604081101561017e57600080fd5b810190808035906020019064010000000081111561019b57600080fd5b8201836020820111156101ad57600080fd5b803590602001918460018302840111640100000000831117156101cf57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001909291905050506108ec565b005b6102f06004803603604081101561024357600080fd5b810190808035906020019064010000000081111561026057600080fd5b82018360208201111561027257600080fd5b8035906020019184600183028401116401000000008311171561029457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610ac7565b005b6103ab6004803603602081101561030857600080fd5b810190808035906020019064010000000081111561032557600080fd5b82018360208201111561033757600080fd5b8035906020019184600183028401116401000000008311171561035957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610c1c565b6040518082815260200191505060405180910390f35b61047a600480360360208110156103d757600080fd5b81019080803590602001906401000000008111156103f457600080fd5b82018360208201111561040657600080fd5b8035906020019184600183028401116401000000008311171561042857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610d08565b005b61053f6004803603604081101561049257600080fd5b81019080803590602001906401000000008111156104af57600080fd5b8201836020820111156104c157600080fd5b803590602001918460018302840111640100000000831117156104e357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610e54565b005b6106916004803603604081101561055757600080fd5b810190808035906020019064010000000081111561057457600080fd5b82018360208201111561058657600080fd5b803590602001918460018302840111640100000000831117156105a857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060b57600080fd5b82018360208201111561061d57600080fd5b8035906020019184600183028401116401000000008311171561063f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610f3d565b005b61069b6110fe565b005b6107f7600480360360608110156106b357600080fd5b81019080803590602001906401000000008111156106d057600080fd5b8201836020820111156106e257600080fd5b8035906020019184600183028401116401000000008311171561070457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561076757600080fd5b82018360208201111561077957600080fd5b8035906020019184600183028401116401000000008311171561079b57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611163565b005b610801611332565b005b60006001836040518082805190602001908083835b6020831061083b5780518252602082019150602081019050602083039250610818565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060008290508082016001856040518082805190602001908083835b602083106108af578051825260208201915060208101905060208303925061088c565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390208190555050505050565b60006002836040518082805190602001908083835b602083106109245780518252602082019150602081019050602083039250610901565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060006001846040518082805190602001908083835b60208310610992578051825260208201915060208101905060208303925061096f565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390205490506000839050818301811015610a4f576001818403036002866040518082805190602001908083835b60208310610a1357805182526020820191506020810190506020830392506109f0565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902081905550610ac0565b8083036002866040518082805190602001908083835b60208310610a885780518252602082019150602081019050602083039250610a65565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020819055505b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630553904e3084846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b83811015610b8e578082015181840152602081019050610b73565b50505050905090810190601f168015610bbb5780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b158015610bdc57600080fd5b505af1158015610bf0573d6000803e3d6000fd5b505050506040513d6020811015610c0657600080fd5b8101908080519060200190929190505050505050565b6000806001836040518082805190602001908083835b60208310610c555780518252602082019150602081019050602083039250610c32565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060006002846040518082805190602001908083835b60208310610cc35780518252602082019150602081019050602083039250610ca0565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905080820192508292505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166311e3f2af30836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610dc8578082015181840152602081019050610dad565b50505050905090810190601f168015610df55780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015610e1557600080fd5b505af1158015610e29573d6000803e3d6000fd5b505050506040513d6020811015610e3f57600080fd5b81019080805190602001909291905050505050565b60006002836040518082805190602001908083835b60208310610e8c5780518252602082019150602081019050602083039250610e69565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060008290508082016002856040518082805190602001908083835b60208310610f005780518252602082019150602081019050602083039250610edd565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390208190555050505050565b60006001836040518082805190602001908083835b60208310610f755780518252602082019150602081019050602083039250610f52565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152",
        "602001604051809103902054905060006002836040518082805190602001908083835b60208310610fe35780518252602082019150602081019050602083039250610fc0565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060006002856040518082805190602001908083835b60208310611051578051825260208201915060208101905060208303925061102e565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020819055508082016001846040518082805190602001908083835b602083106110c1578051825260208201915060208101905060208303925061109e565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390208190555050505050565b61113e6040518060400160405280601d81526020017f75706461746562616c616e636528737472696e672c75696e74323536290000008152506001610ac7565b611161604051806060016040528060228152602001611394602291396002610ac7565b565b60006002846040518082805190602001908083835b6020831061119b5780518252602082019150602081019050602083039250611178565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060006002846040518082805190602001908083835b6020831061120957805182526020820191506020810190506020830392506111e6565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020549050600083905080830392508082019150826002876040518082805190602001908083835b602083106112855780518252602082019150602081019050602083039250611262565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902081905550816002866040518082805190602001908083835b602083106112f357805182526020820191506020810190506020830392506112d0565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902081905550505050505050565b6113706040518060400160405280601d81526020017f75706461746562616c616e636528737472696e672c75696e7432353629000000815250610d08565b61139160405180606001604052806022815260200161139460229139610d08565b56fe73656e647061796d656e7428737472696e672c737472696e672c75696e7432353629a26469706673582212209729cc43225fdd7d6437e3b4f64106310312a6262d9e25ad7d5dbc1293700ec564736f6c634300060a0033"
    };

    public static final String BINARY =
            org.fisco.bcos.sdk.v3.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {
        "60806040526110066000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561005257600080fd5b506113ea806100626000396000f3fe608060405234801561001057600080fd5b506004361061009d5760003560e01c806394618e4c1161006657806394618e4c146104e4578063b484c3e9146104ee578063b4c653e0146105b3578063d502393114610678578063f977b2721461073d5761009d565b8062f0e133146100a2578063505deccf1461015d578063563a765f1461022c578063654d116514610388578063748e7a1b146104da575b600080fd5b61015b600480360360208110156100b857600080fd5b81019080803590602001906401000000008111156100d557600080fd5b8201836020820111156100e757600080fd5b8035906020019184600183028401116401000000008311171561010957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610802565b005b6102166004803603602081101561017357600080fd5b810190808035906020019064010000000081111561019057600080fd5b8201836020820111156101a257600080fd5b803590602001918460018302840111640100000000831117156101c457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061094e565b6040518082815260200191505060405180910390f35b6103866004803603606081101561024257600080fd5b810190808035906020019064010000000081111561025f57600080fd5b82018360208201111561027157600080fd5b8035906020019184600183028401116401000000008311171561029357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156102f657600080fd5b82018360208201111561030857600080fd5b8035906020019184600183028401116401000000008311171561032a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610a3a565b005b6104d86004803603604081101561039e57600080fd5b81019080803590602001906401000000008111156103bb57600080fd5b8201836020820111156103cd57600080fd5b803590602001918460018302840111640100000000831117156103ef57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561045257600080fd5b82018360208201111561046457600080fd5b8035906020019184600183028401116401000000008311171561048657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610c09565b005b6104e2610dca565b005b6104ec610e2b565b005b6105b16004803603604081101561050457600080fd5b810190808035906020019064010000000081111561052157600080fd5b82018360208201111561053357600080fd5b8035906020019184600183028401116401000000008311171561055557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610e90565b005b610676600480360360408110156105c957600080fd5b81019080803590602001906401000000008111156105e657600080fd5b8201836020820111156105f857600080fd5b8035906020019184600183028401116401000000008311171561061a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061106b565b005b61073b6004803603604081101561068e57600080fd5b81019080803590602001906401000000008111156106ab57600080fd5b8201836020820111156106bd57600080fd5b803590602001918460018302840111640100000000831117156106df57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001909291905050506111c0565b005b6108006004803603604081101561075357600080fd5b810190808035906020019064010000000081111561077057600080fd5b82018360208201111561078257600080fd5b803590602001918460018302840111640100000000831117156107a457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001909291905050506112a9565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663714c65bd30836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156108c25780820151818401526020810190506108a7565b50505050905090810190601f1680156108ef5780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15801561090f57600080fd5b505af1158015610923573d6000803e3d6000fd5b505050506040513d602081101561093957600080fd5b81019080805190602001909291905050505050565b6000806001836040518082805190602001908083835b602083106109875780518252602082019150602081019050602083039250610964565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060006002846040518082805190602001908083835b602083106109f557805182526020820191506020810190506020830392506109d2565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905080820192508292505050919050565b60006002846040518082805190602001908083835b60208310610a725780518252602082019150602081019050602083039250610a4f565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060006002846040518082805190602001908083835b60208310610ae05780518252602082019150602081019050602083039250610abd565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020549050600083905080830392508082019150826002876040518082805190602001908083835b60208310610b5c5780518252602082019150602081019050602083039250610b39565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902081905550816002866040518082805190602001908083835b60208310610bca5780518252602082019150602081019050602083039250610ba7565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902081905550505050505050565b60006001836040518082805190602001908083835b60208310610c415780518252602082019150602081019050602083039250610c1e565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060006002836040518082805190602001908083835b60208310610caf5780518252602082019150602081019050602083039250610c8c565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060006002856040518082805190602001908083835b60208310610d1d5780518252602082019150602081019050602083039250610cfa565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020819055508082016001846040518082805190602001908083835b60208310610d8d5780518252602082019150602081019050602083039250610d6a565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390208190555050505050565b610e086040518060400160405280601d81526020017f75706461746562616c616e636528737472696e672c75696e7432353629000000815250610802565b610e2960405180606001604052806022815260200161139360229139610802565b565b610e6b6040518060400160405280601d81526020017f75706461746562616c616e636528737472696e672c75696e7432353629000000815250600161106b565b610e8e60405180606001604052806022815260200161139360229139600261106b565b565b60006002836040518082805190602001908083835b60208310610ec85780518252602082019150602081019050602083039250610ea5565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060006001846040518082805190602001908083835b60208310610f365780518252602082019150602081019050602083039250610f13565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390205490506000839050818301811015610ff3576001818403036002866040518082805190602001908083835b60208310610fb75780",
        "518252602082019150602081019050602083039250610f94565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902081905550611064565b8083036002866040518082805190602001908083835b6020831061102c5780518252602082019150602081019050602083039250611009565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020819055505b5050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dc536a623084846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b83811015611132578082015181840152602081019050611117565b50505050905090810190601f16801561115f5780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b15801561118057600080fd5b505af1158015611194573d6000803e3d6000fd5b505050506040513d60208110156111aa57600080fd5b8101908080519060200190929190505050505050565b60006001836040518082805190602001908083835b602083106111f857805182526020820191506020810190506020830392506111d5565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060008290508082016001856040518082805190602001908083835b6020831061126c5780518252602082019150602081019050602083039250611249565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390208190555050505050565b60006002836040518082805190602001908083835b602083106112e157805182526020820191506020810190506020830392506112be565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902054905060008290508082016002856040518082805190602001908083835b602083106113555780518252602082019150602081019050602083039250611332565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020819055505050505056fe73656e647061796d656e7428737472696e672c737472696e672c75696e7432353629a2646970667358221220cfb376594ad41335616e9457f1efd488ff0dab1162b77f9ddfd36b364b07f83c64736f6c634300060a0033"
    };

    public static final String SM_BINARY =
            org.fisco.bcos.sdk.v3.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {
        "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"arg0\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"arg1\",\"type\":\"string\"}],\"name\":\"almagate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableParallel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enableParallel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"arg0\",\"type\":\"string\"}],\"name\":\"getBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"functionName\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"criticalSize\",\"type\":\"uint256\"}],\"name\":\"registerParallelFunction\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"arg0\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"arg1\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"arg2\",\"type\":\"uint256\"}],\"name\":\"sendPayment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"functionName\",\"type\":\"string\"}],\"name\":\"unregisterParallelFunction\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"arg0\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"arg1\",\"type\":\"uint256\"}],\"name\":\"updateBalance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"arg0\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"arg1\",\"type\":\"uint256\"}],\"name\":\"updateSaving\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"arg0\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"arg1\",\"type\":\"uint256\"}],\"name\":\"writeCheck\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
    };

    public static final String ABI = org.fisco.bcos.sdk.v3.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_ALMAGATE = "almagate";

    public static final String FUNC_DISABLEPARALLEL = "disableParallel";

    public static final String FUNC_ENABLEPARALLEL = "enableParallel";

    public static final String FUNC_GETBALANCE = "getBalance";

    public static final String FUNC_REGISTERPARALLELFUNCTION = "registerParallelFunction";

    public static final String FUNC_SENDPAYMENT = "sendPayment";

    public static final String FUNC_UNREGISTERPARALLELFUNCTION = "unregisterParallelFunction";

    public static final String FUNC_UPDATEBALANCE = "updateBalance";

    public static final String FUNC_UPDATESAVING = "updateSaving";

    public static final String FUNC_WRITECHECK = "writeCheck";

    protected ParallelSmallbank(
            String contractAddress, String address, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public static String getABI() {
        return ABI;
    }

    public TransactionReceipt almagate(String arg0, String arg1) {
        final Function function =
                new Function(
                        FUNC_ALMAGATE,
                        Arrays.<Type>asList(new Utf8String(arg0), new Utf8String(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void almagate(String arg0, String arg1, TransactionCallback callback) {
        final Function function =
                new Function(
                        FUNC_ALMAGATE,
                        Arrays.<Type>asList(new Utf8String(arg0), new Utf8String(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForAlmagate(String arg0, String arg1) {
        final Function function =
                new Function(
                        FUNC_ALMAGATE,
                        Arrays.<Type>asList(new Utf8String(arg0), new Utf8String(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, String> getAlmagateInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function =
                new Function(
                        FUNC_ALMAGATE,
                        Arrays.<Type>asList(),
                        Arrays.<TypeReference<?>>asList(
                                new TypeReference<Utf8String>() {},
                                new TypeReference<Utf8String>() {}));
        List<Type> results =
                this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, String>(
                (String) results.get(0).getValue(), (String) results.get(1).getValue());
    }

    public TransactionReceipt disableParallel() {
        final Function function =
                new Function(
                        FUNC_DISABLEPARALLEL,
                        Arrays.<Type>asList(),
                        Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void disableParallel(TransactionCallback callback) {
        final Function function =
                new Function(
                        FUNC_DISABLEPARALLEL,
                        Arrays.<Type>asList(),
                        Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForDisableParallel() {
        final Function function =
                new Function(
                        FUNC_DISABLEPARALLEL,
                        Arrays.<Type>asList(),
                        Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public TransactionReceipt enableParallel() {
        final Function function =
                new Function(
                        FUNC_ENABLEPARALLEL,
                        Arrays.<Type>asList(),
                        Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void enableParallel(TransactionCallback callback) {
        final Function function =
                new Function(
                        FUNC_ENABLEPARALLEL,
                        Arrays.<Type>asList(),
                        Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForEnableParallel() {
        final Function function =
                new Function(
                        FUNC_ENABLEPARALLEL,
                        Arrays.<Type>asList(),
                        Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public BigInteger getBalance(String arg0) throws ContractException {
        final Function function =
                new Function(
                        FUNC_GETBALANCE,
                        Arrays.<Type>asList(new Utf8String(arg0)),
                        Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public TransactionReceipt registerParallelFunction(
            String functionName, BigInteger criticalSize) {
        final Function function =
                new Function(
                        FUNC_REGISTERPARALLELFUNCTION,
                        Arrays.<Type>asList(
                                new Utf8String(functionName), new Uint256(criticalSize)),
                        Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void registerParallelFunction(
            String functionName, BigInteger criticalSize, TransactionCallback callback) {
        final Function function =
                new Function(
                        FUNC_REGISTERPARALLELFUNCTION,
                        Arrays.<Type>asList(
                                new Utf8String(functionName), new Uint256(criticalSize)),
                        Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForRegisterParallelFunction(
            String functionName, BigInteger criticalSize) {
        final Function function =
                new Function(
                        FUNC_REGISTERPARALLELFUNCTION,
                        Arrays.<Type>asList(
                                new Utf8String(functionName), new Uint256(criticalSize)),
                        Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, BigInteger> getRegisterParallelFunctionInput(
            TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function =
                new Function(
                        FUNC_REGISTERPARALLELFUNCTION,
                        Arrays.<Type>asList(),
                        Arrays.<TypeReference<?>>asList(
                                new TypeReference<Utf8String>() {},
                                new TypeReference<Uint256>() {}));
        List<Type> results =
                this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, BigInteger>(
                (String) results.get(0).getValue(), (BigInteger) results.get(1).getValue());
    }

    public TransactionReceipt sendPayment(String arg0, String arg1, BigInteger arg2) {
        final Function function =
                new Function(
                        FUNC_SENDPAYMENT,
                        Arrays.<Type>asList(
                                new Utf8String(arg0), new Utf8String(arg1), new Uint256(arg2)),
                        Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void sendPayment(
            String arg0, String arg1, BigInteger arg2, TransactionCallback callback) {
        final Function function =
                new Function(
                        FUNC_SENDPAYMENT,
                        Arrays.<Type>asList(
                                new Utf8String(arg0), new Utf8String(arg1), new Uint256(arg2)),
                        Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForSendPayment(String arg0, String arg1, BigInteger arg2) {
        final Function function =
                new Function(
                        FUNC_SENDPAYMENT,
                        Arrays.<Type>asList(
                                new Utf8String(arg0), new Utf8String(arg1), new Uint256(arg2)),
                        Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple3<String, String, BigInteger> getSendPaymentInput(
            TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function =
                new Function(
                        FUNC_SENDPAYMENT,
                        Arrays.<Type>asList(),
                        Arrays.<TypeReference<?>>asList(
                                new TypeReference<Utf8String>() {},
                                new TypeReference<Utf8String>() {},
                                new TypeReference<Uint256>() {}));
        List<Type> results =
                this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple3<String, String, BigInteger>(
                (String) results.get(0).getValue(),
                (String) results.get(1).getValue(),
                (BigInteger) results.get(2).getValue());
    }

    public TransactionReceipt unregisterParallelFunction(String functionName) {
        final Function function =
                new Function(
                        FUNC_UNREGISTERPARALLELFUNCTION,
                        Arrays.<Type>asList(new Utf8String(functionName)),
                        Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void unregisterParallelFunction(String functionName, TransactionCallback callback) {
        final Function function =
                new Function(
                        FUNC_UNREGISTERPARALLELFUNCTION,
                        Arrays.<Type>asList(new Utf8String(functionName)),
                        Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForUnregisterParallelFunction(String functionName) {
        final Function function =
                new Function(
                        FUNC_UNREGISTERPARALLELFUNCTION,
                        Arrays.<Type>asList(new Utf8String(functionName)),
                        Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple1<String> getUnregisterParallelFunctionInput(
            TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function =
                new Function(
                        FUNC_UNREGISTERPARALLELFUNCTION,
                        Arrays.<Type>asList(),
                        Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
        List<Type> results =
                this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<String>((String) results.get(0).getValue());
    }

    public TransactionReceipt updateBalance(String arg0, BigInteger arg1) {
        final Function function =
                new Function(
                        FUNC_UPDATEBALANCE,
                        Arrays.<Type>asList(new Utf8String(arg0), new Uint256(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void updateBalance(String arg0, BigInteger arg1, TransactionCallback callback) {
        final Function function =
                new Function(
                        FUNC_UPDATEBALANCE,
                        Arrays.<Type>asList(new Utf8String(arg0), new Uint256(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForUpdateBalance(String arg0, BigInteger arg1) {
        final Function function =
                new Function(
                        FUNC_UPDATEBALANCE,
                        Arrays.<Type>asList(new Utf8String(arg0), new Uint256(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, BigInteger> getUpdateBalanceInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function =
                new Function(
                        FUNC_UPDATEBALANCE,
                        Arrays.<Type>asList(),
                        Arrays.<TypeReference<?>>asList(
                                new TypeReference<Utf8String>() {},
                                new TypeReference<Uint256>() {}));
        List<Type> results =
                this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, BigInteger>(
                (String) results.get(0).getValue(), (BigInteger) results.get(1).getValue());
    }

    public TransactionReceipt updateSaving(String arg0, BigInteger arg1) {
        final Function function =
                new Function(
                        FUNC_UPDATESAVING,
                        Arrays.<Type>asList(new Utf8String(arg0), new Uint256(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void updateSaving(String arg0, BigInteger arg1, TransactionCallback callback) {
        final Function function =
                new Function(
                        FUNC_UPDATESAVING,
                        Arrays.<Type>asList(new Utf8String(arg0), new Uint256(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForUpdateSaving(String arg0, BigInteger arg1) {
        final Function function =
                new Function(
                        FUNC_UPDATESAVING,
                        Arrays.<Type>asList(new Utf8String(arg0), new Uint256(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, BigInteger> getUpdateSavingInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function =
                new Function(
                        FUNC_UPDATESAVING,
                        Arrays.<Type>asList(),
                        Arrays.<TypeReference<?>>asList(
                                new TypeReference<Utf8String>() {},
                                new TypeReference<Uint256>() {}));
        List<Type> results =
                this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, BigInteger>(
                (String) results.get(0).getValue(), (BigInteger) results.get(1).getValue());
    }

    public TransactionReceipt writeCheck(String arg0, BigInteger arg1) {
        final Function function =
                new Function(
                        FUNC_WRITECHECK,
                        Arrays.<Type>asList(new Utf8String(arg0), new Uint256(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void writeCheck(String arg0, BigInteger arg1, TransactionCallback callback) {
        final Function function =
                new Function(
                        FUNC_WRITECHECK,
                        Arrays.<Type>asList(new Utf8String(arg0), new Uint256(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForWriteCheck(String arg0, BigInteger arg1) {
        final Function function =
                new Function(
                        FUNC_WRITECHECK,
                        Arrays.<Type>asList(new Utf8String(arg0), new Uint256(arg1)),
                        Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple2<String, BigInteger> getWriteCheckInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function =
                new Function(
                        FUNC_WRITECHECK,
                        Arrays.<Type>asList(),
                        Arrays.<TypeReference<?>>asList(
                                new TypeReference<Utf8String>() {},
                                new TypeReference<Uint256>() {}));
        List<Type> results =
                this.functionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple2<String, BigInteger>(
                (String) results.get(0).getValue(), (BigInteger) results.get(1).getValue());
    }

    public static ParallelSmallbank load(
            String contractAddress, Client client, CryptoKeyPair credential) {
        return new ParallelSmallbank(contractAddress, contractAddress, client, credential);
    }

    public static ParallelSmallbank deploy(Client client, CryptoKeyPair credential)
            throws ContractException {
        return deploy(
                ParallelSmallbank.class,
                client,
                credential,
                getBinary(client.getCryptoSuite()),
                null,
                null,
                null);
    }
}
